$(function () {
    findAll();
})

function findAll() {
    $.ajax({
        url: '/back/cuisine/findAll',
        data: {},
        type: "get",
        dataType: "json",
        success: function (data) {
            console.log(data);
            setData(data.list);
        }
    })
}

function setData(data) {
    let html = '';

    for (let i = 0; i < data.length; i++) {
        html += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
    }
    $("#cuisineName").html(html);
    let id = sessionStorage.getItem("productId");
    if (id != null) {
        findById();
        sessionStorage.setItem("productId", null);
    }

}